package com.zhanghp.demo01.generic.lab02;

import com.zhanghp.demo01.generic.fundament.Publisher;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zhanghp
 * @date 2022-08-26 15:04
 */
@Slf4j
public class Weather extends Publisher<Race, WeatherType> {
    private WeatherType actionType;

    public Weather() {
        actionType = WeatherType.RAIN;
    }

    public void changeAction(){
        var enums = WeatherType.values();
        actionType = enums[(actionType.ordinal() + 1) % enums.length];
        log.info("face the weather is changed to {}", actionType);
        notifyObservers(actionType);
    }
}
